package com.design.StateMode.simpleDemo;

/**
 * @Description: 绿灯状态处理
 * @Author: LiHaiChao
 * @Date: 2022/1/13 13:57:16
 * @Version: 1.0
 */
public class GreenState implements State{

    public static final String GREEN_LAMP = "green";

    private String lamp;

    public GreenState(String lamp) {
        this.lamp = lamp;
    }

    @Override
    public void handler() {
        if(lamp.equals(GREEN_LAMP)){
            System.out.println("当前绿灯 -> 行车!");
        }else{
            System.out.println("错误状态");
        }
    }
}
